using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;
using log4net;

namespace DataAccess
{
    public class tbResource_Proxy
    {
        ILog log = LogManager.GetLogger(typeof(DataAccess.tbResource).Name);
        Popular cur = new tbResource();
        public bool Insert_tbResource_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Insert(cn);
            }
            catch (Exception)
            {
                kq = false;
            }
            if (kq)
                log.Info(" form tbResource insert success");
            else
                log.Info("form tbResource insert fail");
            return kq;
        }
        public bool Update_tbResource_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Update(cn);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbResource update success");
            else
                log.Info("form tbResource update fail");
            return kq;
        }
        public bool Delete_tbResource_Proxy(object b)
        {
            bool kq = true;
            try
            {
                kq = cur.Delete(b);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbResource delete success");
            else
                log.Info("form tbResource delete fail");
            return kq;
        }
        public IDataReader GetById_tbResource_Proxy(object b)
        {
            log.Info(" form tbResource Search by Id");
            try { return cur.Select_ID(b); }
            catch (Exception) { throw; }
        }
        public List<tbResource> GetByOrg_TypeRe_tbResource_Proxy(object []b)
        {
            tbResource re = new tbResource();
            log.Info(" form tbResource Search by Id");
            try { return re.Select_Org_ReType(b); }
            catch (Exception) { throw; }
        }
        public IDataReader GetByName_tbResource_Proxy(object b)
        {
            log.Info(" form tbResource Search by Name");
            return cur.Select_Name(b);
        }
        public IDataReader SelectNo_tbResource_Proxy(object b)
        {
            log.Info(" form tbResource Search ");
            if (ConvertType.ToInt(b) != 0)
                return cur.Select_ID(b);
            return cur.Select_Name(b);
        }
        public IDataReader SelectAll_tbResource_Proxy()
        {
            log.Info(" form tbResource Load data");
            try { return cur.SelectAll(); }
            catch (Exception) { throw; }
        }
        public List<tbResource> SelectAlltbResource_Proxy()
        {
            tbResource kh = new tbResource();
            return kh.SelectAllToList();
        }
    }
}